 // 创建用户集合
// 引入mongoose第三方模块
const mongoose = require('mongoose');
const recommends = require('../routes/home/recommends');
const {Commodity} = require("./commodity");

// 创建用户集合规则
const recommendSchema = new mongoose.Schema({
    //商品编号
    Art_No:{
        type: String,
        unique: true,
        require: true,
    },
    user_id:{
        type:String,
        require: true
    },
    ISBN:{
        type: String,
        require: true
    }
});

// 创建集合
const Recommend = mongoose.model('Recommend', recommendSchema);

async function createRecommend () {
	const book = await Recommend.create({
        Art_No: "6wDBtuPmijxGRopi", 
        user_id:"f45785c0-9770-11eb-b162-9b03e19ba06c",
        ISBN:"9787501454433"
	});
    console.log("创建成功")
}
//createRecommend();

// 将用户集合做为模块成员进行导出
module.exports = {
    Recommend
}; 